package com.bw.ppjokeplay.adapter

import android.content.Intent
import android.widget.ImageView
import android.widget.TextView
import com.bumptech.glide.Glide
import com.bw.ppjokeplay.App
import com.bw.ppjokeplay.R
import com.bw.ppjokeplay.mvvm.model.entity.FeedEntity
import com.bw.ppjokeplay.mvvm.view.home.Commentsactivity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import org.w3c.dom.Text

/**
 * @author Lishaohe
 * @description:
 * @date :2021/11/10 0010 下午 6:39
 *
 */
class HomeListAdapter: BaseQuickAdapter<FeedEntity, BaseViewHolder>(R.layout.layout_video) {
        init {
            addChildClickViewIds(R.id.imdiss,R.id.imfavorite,R.id.commentCount)

        }
    var likeCount: Int ?= null

    override fun convert(holder: BaseViewHolder, item: FeedEntity) {

        val view = holder.getView<StandardGSYVideoPlayer>(R.id.list_player_view)
        view.setUp(item.url,false,"")
        val imageView = ImageView(context)
        imageView.scaleType=ImageView.ScaleType.CENTER_CROP
        Glide.with(context).load(item.cover).into(imageView)
        view.thumbImageView = imageView
        Glide.with(context).load(item.author!!.avatar).circleCrop().into(holder.getView(R.id.avatar))
        holder.setText(R.id.author_name,item.author!!.name)
        holder.setText(R.id.feeds_text,item.feeds_text)
        holder.setText(R.id.feeds_text,item.feeds_text)
        holder.setText(R.id.description,item.author!!.description)
        likeCount = item.ugc!!.likeCount

        holder.setText(R.id.favorite,""+likeCount)
        holder.setText(R.id.commentCount,""+item.ugc!!.commentCount)
        holder.setText(R.id.diss,""+item.ugc!!.hasFavorite)
        holder.setText(R.id.feedCount,""+item.ugc!!.shareCount)
        val view1 = holder.getView<TextView>(R.id.commentCount)



    }
}